home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Tools - Objects / Installation Folder / Install < prev    next >
Text File  |  1990-07-23  |  9KB  |  378 lines

  1. #    C D   I N S T A L L A T I O N   S C R I P T
  2. #
  3. #    Copyright Apple Computer, Inc. 1987, 1988, 1989, 1990
  4. #    All rights reserved.
  5. #
  6. #    This script is used to install MPW, MacApp, C++, SADE, MacsBug,
  7. #    ResEdit and MPW 411 from the E.T.O. #1 distribution compact disk 
  8. #    onto a destination hard disk. This can also update from previous 
  9. #    versions of these products to the latest releases and revert from
  10. #    later versions to a previous release.
  11. #
  12. #    This script accepts the following options (set by the Commando interface):
  13. #
  14. #    -to            sets the "to" directory
  15. #    -from        sets the "from" directory(s)
  16. #    -custom        sets the custom files list
  17. #
  18. #    -install    flag to install a new complete version of MPW
  19. #    -update        flag to update an existing version of MPW (default behaviour)
  20. #    -revert        flag to revert to a previous version of MPW
  21. #
  22. #    -progress    flag to show progress
  23. #
  24. #    -SADE1.0    flag to install SADE environment (version 1.0)
  25. #    -SADE1.1    flag to install SADE environment (version 1.1)
  26. #    -SADE1.2    flag to install SADE environment (version 1.2a1)
  27. #
  28. #    -MB6.1        flag to install Macsbug (version 6.1 - in System Folder)
  29. #    -MB6.2        flag to install Macsbug (version 6.2a4 - in System Folder)
  30. #
  31. #    -MPW3.0        flag to install MPW (version 3.0)
  32. #    -MPW3.1        flag to install MPW (version 3.1)
  33. #    -MPW3.2        flag to install MPW (version 3.2 EXP)
  34. #
  35. #    -MacApp        flag to install MacApp (version 2.0)
  36. #    -C++1        flag to install C++ (version 3.1b1)
  37. #    -C++4        flag to install C++ (version 3.1b4)
  38. #
  39. #    -411Tools    flag to install 411 in MPW folder (Tools only)
  40. #    -411All        flag to install 411 in MPW folder (Complete environment)
  41. #
  42.  
  43. ##################
  44. ###    DEBUG CODE ###
  45. ##################
  46.  
  47. Set    DebugFlag    0        # Set to 1 for debugging, set to 0 for normal operation
  48.  
  49. ##################
  50.             
  51. Set quit 0                # Clear our user-defined quit flag.  If it
  52.                         # is ever Set non-zero, the user hit cancel
  53.                         # somewhere and the script quits immediately.
  54. Set Exit 0
  55.  
  56. ###                        Set some defaults
  57.             
  58. Set CDVolume    "E.T.O. #1:"    ### the volume name of the distribution CD
  59. Export CDVolume
  60.             
  61. #    {DestVolume} - the volume name of the destination hard drive
  62.             
  63. ###                        Get the current volume name
  64.  
  65.  
  66. Set DestVolume `which "{0}"`                    # get pathname of this script
  67. Set DestVolume "`files -q -f "{DestVolume}"`"    # convert to full pathname
  68. If "{DestVolume}"=~/(≈:)®1≈/                    # strip the filename
  69.     Set DestVolume "{®1}"
  70. End
  71. Loop
  72.     If "{DestVolume}"=~/(≈:)®1≈:/                # strip all sub-directories
  73.         Set DestVolume "{®1}"
  74.     Else
  75.         Break
  76.     End
  77. End
  78.  
  79. export    DestVolume
  80.  
  81. ###    Export some variables used by the Installer
  82.  
  83. set    ToDir        "'{DestVolume}MPW Folder:'"    # Destination ("to") directory
  84. set    ChkDir        "{DestVolume}MPW Folder:"    # Destination ("to") directory
  85. set    FromDirs    ""                            # Source ("from") directory list
  86.  
  87. set InstallFlag    1        # Controls Update/Install/Revert (Update is the default)
  88. set UpdateFlag    "Update"
  89.  
  90. set    RevertFlag    ""        # Controls revert function
  91. set    ProgressOption    ""    # Controls progress display
  92.  
  93. set    MacAppFlag        0    # set for MacApp Installation (to install 411 files)
  94. export    MacAppFlag
  95.  
  96. set    SADEOption        0    # Controls SADE Installation
  97. export SADEOption
  98.  
  99. set MacsbugOption    0    # Controls Macsbug Installation
  100. export MacsbugOption
  101.  
  102. set    411Option        0    # Controls 411 Installation
  103. export 411Option
  104.  
  105. set    ResEditOption    0    # Controls ResEdit Installation
  106. export ResEditOption
  107.  
  108. ###        Source Directories
  109.  
  110. set MPWSource    "{CDVolume}Tools - Objects:Macintosh Programmer’s Workshop:"
  111. export MPWSource
  112.  
  113. set MacAppSource    "{CDVolume}Tools - Objects:MacApp:MacApp 2.0 CD Release:"
  114. export MacAppSource
  115.  
  116. set CPlusSource    "{CDVolume}Tools - Objects:C∂+∂+:"
  117. export CPlusSource
  118.  
  119. ###     Let's get started...
  120.  
  121. If "{#}" == "0"        ### Command Line is Empty
  122.     Exit 1
  123. End
  124.  
  125. ###     See if the source volume exists...
  126.  
  127. If Not "`Exists -d "{CDVolume}"`"
  128.         Alert "Volume {CDVolume} is not online!"
  129.         Exit 1
  130. End
  131.  
  132. ###        Collect the script parameters.
  133. Loop
  134.     Break if {#} == 0
  135.     If "{1}" =~ /-from/
  136.         Set FromDirs "{FromDirs}'{2}' "
  137.         shift 2
  138.         continue
  139.     Else If "{1}" =~ /-to/
  140.         Set toDir    "'{2}'"
  141.         shift 2
  142.         continue
  143.     Else If "{1}" =~ /-custom/
  144.         Set FromDirs "{FromDirs}'{2}' "
  145.         shift 2
  146.         continue
  147.     Else If "{1}" =~ /-update/
  148.         set InstallFlag    1
  149.         set    UpdateFlag    "Update"
  150.         set    RevertFlag    ""
  151.         shift 1
  152.         continue
  153.     Else If "{1}" =~ /-install/
  154.         set InstallFlag    2
  155.         set    UpdateFlag    "Install"
  156.         set    RevertFlag    ""
  157.         shift 1
  158.         continue
  159.     Else If "{1}" =~ /-revert/
  160.         set InstallFlag    3
  161.         set    UpdateFlag    "Revert"
  162.         set    RevertFlag    "-revert"
  163.         shift 1 
  164.         continue
  165.     Else If "{1}" =~ /-MPW3.0/
  166.         Set FromDirs "{FromDirs}'{MPWSource}MPW 3.0:MPW:' "
  167.         If Not "`Exists -d {ToDir}`"
  168.             NewFolder {ToDir}
  169.         End
  170.         shift 1
  171.         continue
  172.     Else If "{1}" =~ /-MPW3.1/
  173.         Set FromDirs "{FromDirs}'{MPWSource}MPW 3.1:MPW:' "
  174.         If Not "`Exists -d {ToDir}`"
  175.             NewFolder {ToDir}
  176.         End
  177.         shift 1
  178.         continue
  179.     Else If "{1}" =~ /-MPW3.2/
  180.         Set FromDirs "{FromDirs}'{MPWSource}MPW 3.2 EXP1:MPW:' "
  181.         If Not "`Exists -d {ToDir}`"
  182.             NewFolder {ToDir}
  183.         End
  184.         shift 1
  185.         continue
  186.     Else If "{1}" =~ /-MacApp/
  187.         If "`Exists -d "{MacAppSource}MacApp 2.0 (Hard Disk Ready):"`"
  188.             Set FromDirs "{FromDirs}'{MacAppSource}MacApp 2.0 (Hard Disk Ready):' "
  189.             Set MacAppFlag    1
  190.         End
  191.         shift 1
  192.         continue
  193.     Else If "{1}" =~ /-CPlus1/
  194.         If "`Exists -d "{CPlusSource}MPW C++ 3.1B1:"`"
  195.             Set FromDirs "{FromDirs}'{CPlusSource}MPW C∂+∂+ 3.1B1:' "
  196.         End
  197.         shift 1
  198.         continue
  199.     Else If "{1}" =~ /-CPlus4/
  200.         If "`Exists -d "{CPlusSource}MPW C++ 3.1B4:"`"
  201.             Set FromDirs "{FromDirs}'{CPlusSource}MPW C∂+∂+ 3.1B4:' "
  202.         End
  203.         shift 1
  204.         continue
  205.     Else If "{1}" =~ /-SADE1.0/
  206.         set    SADEOption    1
  207.         shift 1
  208.         continue
  209.     Else If "{1}" =~ /-SADE1.1/
  210.         set    SADEOption    2
  211.         shift 1
  212.         continue
  213.     Else If "{1}" =~ /-SADE1.2/
  214.         set    SADEOption    3
  215.         shift 1
  216.         continue
  217.     Else If "{1}" =~ /-MB6.1/
  218.         set    MacsbugOption    1
  219.         shift 1
  220.         continue
  221.     Else If "{1}" =~ /-MB6.2/
  222.         set    MacsbugOption    2
  223.         shift 1
  224.         continue
  225.     Else If "{1}" =~ /-411Tools/
  226.         set    411Option    1
  227.         shift 1
  228.         continue
  229.     Else If "{1}" =~ /-411All/
  230.         set    411Option    2
  231.         shift 1
  232.         continue
  233.     Else If "{1}" =~ /-ResEdit1.2/
  234.         set    ResEditOption    1
  235.         shift 1
  236.         continue
  237.     Else If "{1}" =~ /-ResEdit2.0/
  238.         set    ResEditOption    2
  239.         shift 1
  240.         continue
  241.     Else If "{1}" =~ /-progress/
  242.         set    ProgressOption    "-p"
  243.         shift 1
  244.         continue
  245.     Else If "{1}" =~ /-≈/
  246.         Echo "### {0} - ∂"{1}∂" is not an option." > Dev:StdErr
  247.         Echo "# Usage - {0} -to dirname [ -from DirName | -custom filename ]" > Dev:StdErr
  248.         Echo "#         [ -install | -update | -revert ] [ -progress ]" > Dev:StdErr
  249.         Echo "#         [ -SADE ] [ -Macsbug ]" > Dev:StdErr
  250.         Exit 1
  251.     End
  252. End
  253.  
  254. If "{ToDir}" == ""
  255.     Echo "### {0} - Must Select Destination Directory"
  256.     Exit 1
  257. Else If "{FromDirs}" == "" && "{SADEOption}" == "0" && 
  258.     "{MacsBugOption}" == "0" && "{411Option}" == "0" && "{ResEditOption}" == "0"
  259.     Echo "### {0} - Must Select Source Directory"
  260.     Exit 1
  261. End
  262.  
  263. If Not "`Exists -d "{CDVolume}"`"
  264.         Alert "Volume {CDVolume} is not online!"
  265.         Exit 1
  266. End
  267.  
  268. If {DebugFlag} == 1
  269.     echo    "FromDirs:      {FromDirs}"        > Dev:StdOut
  270.     echo    "ToDir:         {ToDir}"        > Dev:StdOut
  271.     echo    "CustomFiles:   {CustomFiles}"    > Dev:StdOut
  272.     echo    "UpdateFlag:    {UpdateFlag}"    > Dev:StdOut
  273.     echo    "InstallFlag:   {InstallFlag}"    > Dev:StdOut
  274.     echo    "RevertFlag:    {RevertFlag}"    > Dev:StdOut
  275.     echo    "RevertOption:  {RevertOption}"    > Dev:StdOut
  276.     echo    "ProgressOption:{ProgressOption}"    > Dev:StdOut
  277.     Exit 1
  278. End
  279.  
  280.  
  281.     
  282.  
  283. # The backup tool will generate shell commands to copy the files off 
  284. # of the distribution compact disk into the final destination folder.
  285.  
  286. If "{FromDirs}" != ""
  287.  
  288.     For dir in {FromDirs}
  289.         "{ShellDirectory}"Backup -from "{dir}" -to {ToDir} -r -a -c {RevertFlag} {ProgressOption} > copyStuff
  290.         
  291.     # The DoIt script will execute the copy commands in the temporary 
  292.     # copyStuff file.  It will highlight each command as it is executed.
  293.         
  294.         "{ShellDirectory}"DoIt copyStuff ≥ errorFile
  295.     End
  296. End
  297.  
  298. ###    Now handle the special cases like SADE, Macsbug, 411 and ResEdit
  299.  
  300.  
  301. ###        One More Time...
  302.  
  303. If Not "`Exists -d "{CDVolume}"`"
  304.     Alert "Volume {CDVolume} is not online!"
  305.     Exit 1
  306. End
  307.  
  308. ###    Special for MacApp - move the UserStartup file up one level and rename the folder
  309.  
  310. If "{MacAppFlag}" != "0"
  311.     If "`Exists -f "{ChkDir}MacApp:UserStartup•MacApp"`"
  312.         catenate "{ChkDir}MacApp:UserStartup•MacApp" >> "{ChkDir}UserStartup•MacApp"
  313.     End
  314.     
  315.     # Automate the "Where is the MacApp folder?" dialogue
  316.     echo "{ChkDir}MacApp:" >> "{ChkDir}MacApp_Folder"
  317. End
  318.  
  319. ### Install SADE 1.0, 1.1 or 1.2a1
  320.  
  321. If "{SADEOption}" != "0"
  322.     If "{ProgressOption}" =~ /-p/ 
  323.         Echo "Now Copying SADE..."
  324.     End
  325.     "SADE Install" ≥ errorFile
  326. End
  327.  
  328. ### Install Macsbug v. 6.1 or 6.2a4
  329.  
  330. If "{MacsbugOption}" != "0"
  331.     If "{ProgressOption}" =~ /-p/ 
  332.         Echo "Now Copying MacsBug..."
  333.     End
  334.     "MacsBug Install" ≥ errorFile
  335. End
  336.  
  337. ###    Install ResEdit
  338.  
  339. If "{ResEditOption}" != "0"
  340.     If "{ProgressOption}" =~ /-p/ 
  341.         Echo "Now Copying ResEdit..."
  342.     End
  343.     "ResEdit Install" ≥ errorFile
  344. End
  345.  
  346. ### Install 411
  347.  
  348. If    "{411Option}" != "0"
  349.     If "{ProgressOption}" =~ /-p/ 
  350.         Echo "Now Copying 411..."
  351.     End
  352.     "411 Install" ≥ errorFile
  353. End
  354.  
  355.  
  356. # If we got some error while copying the file from the distribution 
  357. # compact disk to the destination disk, display the error message and quit.
  358.  
  359. If "`Exists -f "errorFile"`"
  360.     Open -t errorFile
  361.     Find • errorFile
  362.     Find /'#'/ errorFile     ### There is an error
  363.     Set FindStatus {Status}
  364.     Close errorFile
  365. Else
  366.     Set FindStatus 1
  367. End
  368.  
  369. If {FindStatus} == 0
  370.     Alert "`catenate errorFile`"
  371.     Close -n copyStuff ≥ dev:null
  372.     Quit
  373. Else
  374.     Delete copyStuff ≥ dev:null
  375. End
  376.  
  377. Exit 0
  378.